import request from '@/utils/request'
import querystring from 'querystring'

/**
 * 分页查询配件
 * @param {*} form 
 * @param {*} pageSize 
 * @param {*} currentPage 
 */
export function dataList(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/carParts/page',data)
}

/**
 * 查询所有配件信息
 * @param {*} form 
 * @param {*} pageSize 
 * @param {*} currentPage 
 */
export function findAll(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/carParts/findAll',data)
}

/**
 * 新增配件
 * @param {*} options 
 */
export function addData(options) {
  return request.post('/carParts/save', options)
}

/**
 * 修改配件
 * @param {*} options 
 */
export function updateData(options) {
  return request.put('/carParts/save', options)
}

/**
 * 获取配件详情
 * @param {*} id 
 */
export function details(id) {
  return request.get(`/carParts/${id}`)
}

/**
 * 根据门店id和供应商id获取配件类型
 * @param {门店id} storeId 
 * @param {供应商id} supplierId
 */
export function findPartsType(storeId, supplierId) {
  return request.get(`/carParts/partsByStoreAndSpuulier/${storeId}/${supplierId}`)
}



/**
 * 删除配件
 * @param {*} id 
 */
export function deleteData(id) {
  return request.delete(`/carParts/${id}`)
}

/**
 * 根据门店ID获取对应的配件信息
 * @param {*} id 
 */
export function storePartsById(id) {
  return request.get(`/carParts/storeParts/${id}`)
}

